using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class E1_SchoolNewsMap : EntityTypeConfiguration<E1_SchoolNews>
    {
        public E1_SchoolNewsMap()
        {
            // Primary Key
            this.HasKey(t => t.News_Id);

            // Properties
            this.Property(t => t.School_Locale)
                .HasMaxLength(50);

            this.Property(t => t.Headline)
                .HasMaxLength(400);

            this.Property(t => t.Image)
                .HasMaxLength(200);

            this.Property(t => t.siteversion)
                .HasMaxLength(10);

            this.Property(t => t.NewsDesc)
                .IsRequired()
                .HasMaxLength(300);

            this.Property(t => t.ImageAlt1)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Image2)
                .HasMaxLength(50);

            this.Property(t => t.ImageAlt2)
                .HasMaxLength(50);

            this.Property(t => t.Image3)
                .HasMaxLength(50);

            this.Property(t => t.ImageAlt3)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("E1_SchoolNews");
            this.Property(t => t.News_Id).HasColumnName("News_Id");
            this.Property(t => t.School_Locale).HasColumnName("School_Locale");
            this.Property(t => t.Headline).HasColumnName("Headline");
            this.Property(t => t.Image).HasColumnName("Image");
            this.Property(t => t.Text).HasColumnName("Text");
            this.Property(t => t.NewsDate).HasColumnName("NewsDate");
            this.Property(t => t.IsTurnedOn).HasColumnName("IsTurnedOn");
            this.Property(t => t.StartDate).HasColumnName("StartDate");
            this.Property(t => t.siteversion).HasColumnName("siteversion");
            this.Property(t => t.lastupdate).HasColumnName("lastupdate");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.NewsDesc).HasColumnName("NewsDesc");
            this.Property(t => t.ImageAlt1).HasColumnName("ImageAlt1");
            this.Property(t => t.Image2).HasColumnName("Image2");
            this.Property(t => t.ImageAlt2).HasColumnName("ImageAlt2");
            this.Property(t => t.Image3).HasColumnName("Image3");
            this.Property(t => t.ImageAlt3).HasColumnName("ImageAlt3");
        }
    }
}
